package cn.maszy.action.customer;

import org.springframework.beans.factory.annotation.Autowired;

import net.sourceforge.stripes.action.SessionScope;
import cn.maszy.common.BaseAction;
import cn.maszy.common.Pager;
import cn.maszy.model.customer.B_T_Ufp_SellClue;
import cn.maszy.service.customer.B_T_Ufp_SellClueService;

@SessionScope
public class SellClueAction extends BaseAction<B_T_Ufp_SellClue> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 2475349243064011153L;
	private B_T_Ufp_SellClue B_T_Ufp_SellClue;
	@Autowired
	private B_T_Ufp_SellClueService B_T_Ufp_SellClueService;
	private String checkIds;
	
	/*********************class set/get****************************/
	public String getCheckIds() {
		return checkIds;
	}
	public void setCheckIds(String checkIds) {
		this.checkIds = checkIds;
	}
	public B_T_Ufp_SellClue getB_T_Ufp_SellClue() {
		return B_T_Ufp_SellClue;
	}
	public void setB_T_Ufp_SellClue(B_T_Ufp_SellClue B_T_Ufp_SellClue) {
		this.B_T_Ufp_SellClue = B_T_Ufp_SellClue;
	}
	
	/*******************STRUTS ACTION METHOD*************************/
	/**
	 * 页面查询
	 * @return
	 * @throws Exception
	 */
	public String sellclueList() throws Exception {
		pager = new Pager<B_T_Ufp_SellClue>(pageNum, numPerPage,orderField,orderDirection);
		pager= B_T_Ufp_SellClueService.selectList(B_T_Ufp_SellClue,pager);
		return SUCCESS;
	}
	/**
	 * 新增更新
	 * @return
	 * @throws Exception
	 */
	public String sellclueUpdate() throws Exception {
		int i	=B_T_Ufp_SellClueService.update(B_T_Ufp_SellClue);
		if(i>0)
			//目前只有点击提交后关闭
			//return ajaxForwardSuccess(getText("msg.operation.success"), "adminList", "closeCurrent", "investment/adminList");
		//保存不关闭暂时没做
		return ajaxForwardSuccess(getText("msg.operation.success"), "SellclueList","", "forward", "costomer/SellclueList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
 
	/**
	 * 删除一条数据
	 * @return
	 * @throws Exception
	 */
	public String sellclueDel() throws Exception {
		int i=B_T_Ufp_SellClueService.delete(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "SellclueList","", "forward", "costomer/SellclueList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	/**
	 * 
	  * saleSuccess
	  * TODO 销售成功
	  *
	  * @Title: saleSuccess
	  * @Description: TODO
	  * @param @return
	  * @return String
	  * @throws
	 */
	public String saleSuccess(){
		int i=B_T_Ufp_SellClueService.saleSuccess(checkIds);
		if(i>0)
		return ajaxForwardSuccess(getText("msg.operation.success"), "SellclueList","", "forward", "costomer/SellclueList");
		return ajaxForwardError(getText("msg.operation.failure"));
	}
	
	
	
	
	/**
	 * 查询一条数据
	 * @return
	 * @throws Exception
	 */
	public String sellclueDetail() throws Exception {
		if(B_T_Ufp_SellClue==null){
			B_T_Ufp_SellClue=B_T_Ufp_SellClueService.selectOne("");
		}else{
			B_T_Ufp_SellClue=B_T_Ufp_SellClueService.selectOne(B_T_Ufp_SellClue.getUuid());
		}
		return SUCCESS;
	}
}
